from rest_framework import serializers
from .models import Student,Course

class CourseSerializer(serializers.ModelSerializer):

    class Meta:
        model = Course
        fields = ['hobby']

class StudentSerializer(serializers.ModelSerializer):

    course=CourseSerializer(read_only=True)
    class Meta:
        model = Student
        fields = ['id','sex','age','name','course']